<?php

namespace app\index\model;

use think\Controller;
use think\Db;
use think\Model;

class Center extends Model
{

    public function indexdata($id)
    {
        $res = Db::name('user')->where('id', 'eq', $id)->field('pass', true)->find();
        return $res;
    }

    public function trashdata($where)
    {
        $list = Self::where('status', 'eq', '2')->where('name', 'like', $where)->order('id')->paginate(5, false, ['query' => request()->param()]);
        return $list;
    }

    // 插入
    public function savedata($data)
    {
        $this->isUpdate(false)->save($data);
    }

    // 更新
    public function updatedata($data)
    {
        $res = $this->name('user')->update($data);
        return $res;
    }

    // 删除
    public function del($id)
    {
        $res = Self::where('id', 'eq', $id)->delete();
        return $res;
    }
}